package org.opens.sql.genHandle;

import org.opens.sql.constant.GenSqlType;
import org.opens.sql.genHandle.impl.*;

import java.util.HashMap;
import java.util.Map;

public class GenHandleFactory {

    private static Map<GenSqlType, GenHandle> genHandleMap = new HashMap<>();

    static {
        genHandleMap.put(GenSqlType.ENTITY, new GenEntityHandle());
        genHandleMap.put(GenSqlType.MAPPER, new GenMapperHandle());
        genHandleMap.put(GenSqlType.SERVICE, new GenServiceHandle());
        genHandleMap.put(GenSqlType.CONTROLLER, new GenControllerHandle());
        genHandleMap.put(GenSqlType.CONSTANT, new GenConstantHandle());
    }

    public static GenHandle getInstance(GenSqlType genSqlType) {
        return genHandleMap.get(genSqlType);
    }

}
